package com.superlc.ssm.modular.sys.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.superlc.ssm.modular.sys.model.UserInfo;
import com.superlc.ssm.modular.sys.dao.UserInfoDao;
import com.superlc.ssm.modular.sys.service.UserInfoService;

@Service
public class UserInfoServiceImpl implements UserInfoService{

    @Resource
    private UserInfoDao userInfoDao;

    @Override
    public int insert(UserInfo userInfo){
        return userInfoDao.insert(userInfo);
    }

    @Override
    public int insertSelective(UserInfo userInfo){
        return userInfoDao.insertSelective(userInfo);
    }

    @Override
    public int insertList(List<UserInfo> userInfos){
        return userInfoDao.insertList(userInfos);
    }

    @Override
    public int update(UserInfo userInfo){
        return userInfoDao.update(userInfo);
    }

    @Override
    public UserInfo getUserAllInfoByUserName(String username) {
        return userInfoDao.findUserRolePermissionByUserName(username);
    }

    @Override
    public UserInfo getOnlyUserinfoByUserName(String username) {
        return userInfoDao.findUserInfoByUserName(username);
    }

    @Override
    public int addRoleToUserById(Integer uid, Integer roleId) {
        return userInfoDao.addRoleToUserById(uid,roleId);
    }
}
